package demo;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;

public class Test3 {
    public static void main(String[] args) throws IOException {
        //随机点名,第三次一定是张三
        //1.读取到数据并添加到集合中
        BufferedReader br = new BufferedReader(new FileReader("IOTest\\names.txt"));
        ArrayList<String> list = new ArrayList<>();
        String len;
        while((len = br.readLine()) != null){
            list.add(len);
        }
        br.close();
        //2.进行随机
        for (int i = 0; i < 10; i++) {
            Collections.shuffle(list);
            if(i == 2){
                System.out.println(i + "张三");
                continue;
            }
            System.out.println(i + list.get(0));

        }

    }
}

